;; org mode设置
;; 激活org-mode
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-log-done t)
(setq org-directory "~/Files/svncopy/org")
(setq org-agenda-files (file-expand-wildcards "~/Files/svncopy/org/*.org"))
(require 'remember)
(require 'org-remember)
(setq remember-annotation-functions '(org-remember-annotation))
(setq remember-handler-functions '(org-remember-handler))
(add-hook 'remember-mode-hook 'org-remember-apply-template)
(setq org-default-notes-file (concat org-directory "/notes.org"))
(define-key global-map "\C-cr" 'org-remember)
(setq org-todo-keywords
      '((sequence "TODO(t)" "STARTED(s)" "WAITING(w)" "APPT(a)")
	(sequence "|" "DONE(d)" "CANCELLED(c)" "DEFERRED(f)")))
(setq org-tag-alist '((:startgroup . nil)
		      ("@HOME" . ?h) ("@OFFICE" . ?o)
		      (:endgroup . nil)
		      ("EMAIL" . ?e) ("PHONE" . ?n) ("READ" . ?r) ("COMPUTER" . ?c) ("PROJECT" . ?p)))

(setq org-agenda-custom-commands
      '(("D" "Daily Action List"
	 (
	  (agenda "" ((org-agenda-ndays 1)
		      (org-agenda-sorting-strategy
		       (quote ((agenda time-up priority-down tag-up) )))
		      (org-deadline-warning-days 0)
		      )))))
)

(add-hook 'org-mode-hook (lambda()
			   (auto-fill-mode 0)
			   (setq truncate-lines nil)))

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (C . t)
   (python . t)
   (sh . t)))

;; org mode项目设置
(require 'org-publish)

(setq org-export-default-language "zh-Hans-CN"
      org-export-html-extension "html"
      org-export-with-timestamps t
      org-export-with-section-numbers nil
      org-export-with-tags 'not-in-toc
      org-export-skip-text-before-1st-heading nil
      org-export-with-sub-superscripts '{}
      org-export-with-LaTeX-fragments t
      org-export-with-archived-trees nil
      org-export-highlight-first-table-line t
      org-export-latex-listings-w-names nil
      org-export-html-style-include-default nil
      org-export-htmlize-output-type 'css
      org-startup-folded nil
      org-publish-list-skipped-files t
      org-publish-use-timestamps-flag t
      org-export-babel-evaluate nil
      org-confirm-babel-evaluate nil)

(setq org-publish-project-alist
      '(
	("Websites"
	 :base-directory "~/Files/svncopy/org/sites"
	 :base-extension "org"
	 :publishing-directory "~/org-sites/"
	 :recursive nil
	 :publishing-function org-publish-org-to-html
	 :headline-levels 4             ; Just the default for this project.
	 :section-numbers nil
	 :auto-preamble t
	 :auto-postamble t
	 :auto-sitemap t
	 :sitemap-filename "sitemap.org"
	 :sitemap-title "Sitemap"
	 :style "<link rel='stylesheet' type='text/css' href='/css/worg.css' />
<link rel='stylesheet' type='text/css' href='/css/ftable.css' />"
	 )
	("Notes"
	 :base-directory "~/Files/svncopy/org/sites/notes"
	 :base-extension "org"
	 :publishing-directory "~/org-sites/notes"
	 :recursive t
	 :publishing-function org-publish-org-to-html
	 :headline-levels 4             ; Just the default for this project.
	 :section-numbers t
	 :auto-preamble t
	 :auto-postamble t
	 :auto-sitemap t
	 :sitemap-filename "sitemap.org"
	 :sitemap-title "Sitemap"
	 :style "<link rel='stylesheet' type='text/css' href='/css/worg.css' />
<link rel='stylesheet' type='text/css' href='/css/ftable.css' />"
	 )
	("Minutes"
	 :base-directory "~/Files/svncopy/org/sites/minutes"
	 :base-extension "org"
	 :publishing-directory "~/org-sites/minutes"
	 :recursive t
	 :publishing-function org-publish-org-to-html
	 :headline-levels 4             ; Just the default for this project.
	 :section-numbers t
	 :auto-preamble t
	 :auto-postamble t
	 :auto-sitemap t
	 :sitemap-filename "sitemap.org"
	 :sitemap-title "Sitemap"
	 :style "<link rel='stylesheet' type='text/css' href='/css/worg.css' />
<link rel='stylesheet' type='text/css' href='/css/stable.css' />"
	 )
	("Projects"
	 :base-directory "~/Files/svncopy/org/sites/projects"
	 :base-extension "org"
	 :publishing-directory "~/org-sites/projects"
	 :recursive t
	 :publishing-function org-publish-org-to-html
	 :headline-levels 4             ; Just the default for this project.
	 :section-numbers t
	 :auto-preamble t
	 :auto-postamble t
	 :auto-sitemap t
	 :sitemap-filename "sitemap.org"
	 :sitemap-title "Sitemap"
	 :style "<link rel='stylesheet' type='text/css' href='/css/worg.css' />
<link rel='stylesheet' type='text/css' href='/css/stable.css' />"
	 )
	("Tools"
	 :base-directory "~/Files/svncopy/org/sites/tools"
	 :base-extension "org"
	 :publishing-directory "~/org-sites/tools"
	 :recursive t
	 :publishing-function org-publish-org-to-html
	 :headline-levels 4             ; Just the default for this project.
	 :section-numbers t
	 :auto-preamble t
	 :auto-postamble t
	 :auto-sitemap t
	 :sitemap-filename "sitemap.org"
	 :sitemap-title "Sitemap"
	 :style "<link rel='stylesheet' type='text/css' href='/css/worg.css' />
<link rel='stylesheet' type='text/css' href='/css/ftable.css' />"
	 )
	("static"
	 :base-directory "~/Files/svncopy/org/sites/"
	 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
	 :publishing-directory "~/org-sites"
	 :recursive t
	 :publishing-function org-publish-attachment
	 )
	("org" :components ("Websites" "Notes" "Projects" "static"))
	))

;; org2blog
(require 'org2blog-autoloads)
(setq org2blog/wp-blog-alist
      '(("wordpress"
	 :url "http://192.168.1.143/wordpress/xmlrpc.php"
	 :username "wujian"
	 :keep-new-lines t
	 :confirm t)
	("janplus"
	 :url "http://blog.janplus.org/xmlrpc.php"
	 :username "janplus"
	 :keep-new-lines t
	 :confirm t)
	))
(setq org2blog/wp-buffer-template
  "#+DATE: %s
#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil TeX:nil
#+CATEGORY: Heart
#+TAGS:
#+PERMALINK:
#+TITLE:
\n")

(provide 'jerry-org)
